package thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        Thread rose=new Thread(){
            public void run(){
                for(int i=0;i<5;i++){
                    System.out.println("Rose:let me jump!");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                    }

                }
                System.out.println("Rose:啊啊啊啊啊啊啊啊啊啊啊啊AAAAAAAaaaaa.....");
                System.out.println("Rose:扑通!");
            }
        };
        Thread jack=new Thread(){
            public void run(){
                while(true){
                    System.out.println("Jack:you jump,I jump!");
                    try {
                        Thread.sleep(1000);
                    }
                    catch (InterruptedException e) {
                    }
                }
            }
        };
        rose.start();
        jack.setDaemon(true);
        jack.start();
        System.out.println("Main:end");
        while(true);//守护线程守护所有用户线程
    }
}
